package com.ruoyi.bantong.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bantong.domain.BtPlacecardBlacklist;
import com.ruoyi.bantong.service.IBtPlacecardBlacklistService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 席位玩法黑名单Controller
 * 
 * @author laohei
 * @date 2021-01-24
 */
@RestController
@RequestMapping("/bantong/blacklist")
public class BtPlacecardBlacklistController extends BaseController
{
    @Autowired
    private IBtPlacecardBlacklistService btPlacecardBlacklistService;

    /**
     * 查询席位玩法黑名单列表
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:list')")
    @GetMapping("/list")
    public TableDataInfo list(BtPlacecardBlacklist btPlacecardBlacklist)
    {
        startPage();
        List<BtPlacecardBlacklist> list = btPlacecardBlacklistService.selectBtPlacecardBlacklistList(btPlacecardBlacklist);
        return getDataTable(list);
    }

    /**
     * 导出席位玩法黑名单列表
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:export')")
    @Log(title = "席位玩法黑名单", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BtPlacecardBlacklist btPlacecardBlacklist)
    {
        List<BtPlacecardBlacklist> list = btPlacecardBlacklistService.selectBtPlacecardBlacklistList(btPlacecardBlacklist);
        ExcelUtil<BtPlacecardBlacklist> util = new ExcelUtil<BtPlacecardBlacklist>(BtPlacecardBlacklist.class);
        return util.exportExcel(list, "blacklist");
    }

    /**
     * 获取席位玩法黑名单详细信息
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:query')")
    @GetMapping(value = "/{pbId}")
    public AjaxResult getInfo(@PathVariable("pbId") Integer pbId)
    {
        return AjaxResult.success(btPlacecardBlacklistService.selectBtPlacecardBlacklistById(pbId));
    }

    /**
     * 新增席位玩法黑名单
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:add')")
    @Log(title = "席位玩法黑名单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BtPlacecardBlacklist btPlacecardBlacklist)
    {
        return toAjax(btPlacecardBlacklistService.insertBtPlacecardBlacklist(btPlacecardBlacklist));
    }

    /**
     * 修改席位玩法黑名单
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:edit')")
    @Log(title = "席位玩法黑名单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BtPlacecardBlacklist btPlacecardBlacklist)
    {
        return toAjax(btPlacecardBlacklistService.updateBtPlacecardBlacklist(btPlacecardBlacklist));
    }

    /**
     * 删除席位玩法黑名单
     */
    //@PreAuthorize("@ss.hasPermi('bantong:blacklist:remove')")
    @Log(title = "席位玩法黑名单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pbIds}")
    public AjaxResult remove(@PathVariable Integer[] pbIds)
    {
        return toAjax(btPlacecardBlacklistService.deleteBtPlacecardBlacklistByIds(pbIds));
    }
}
